package org.example.bookstore.custom;

import org.springframework.beans.factory.annotation.Value;

public class Constant {

    /**
     * token
     */
    public static int ACCESS_TOKEN_ACTIVE;
    public static int REFRESH_TOKEN_ACTIVE;
    @Value("${constant.token.accessTokenActive}")
    public void setAccessTokenActive(int accessTokenActive) {
        ACCESS_TOKEN_ACTIVE = accessTokenActive;
    }
    @Value("${constant.token.refreshTokenActive}")
    public void setRefreshTokenActive(int refreshTokenActive) {
        REFRESH_TOKEN_ACTIVE = refreshTokenActive;
    }

    /**
     * 2.响应状态 常量
     */
    public static final int RES_FAIL = 400;
    public static final int RES_NOT_FOUND = 404;
    public static final int RES_SUCCESS = 200;
    public static final int RES_ERROR = 500;

    /**
     *  mail
     */
    public static String SendMailer;
    public static String NickName;
    @Value("${spring.mail.username}")
    private void setSendMailer(String sendMailer){ Constant.SendMailer = sendMailer;}
    @Value("${spring.mail.nickname}")
    private void setNickName(String nickName){ Constant.NickName = nickName;}

    /**
     * 4.缓存 相关
     */
    public static int REDIS_INDEX_SERVICE;
    public static int REDIS_INDEX_UTILS;
    @Value("${constant.redis.serviceIndex}")
    public void setRedisIndexService(int redisIndexService) {
        REDIS_INDEX_SERVICE = redisIndexService;
    }
    @Value("${constant.redis.utilsIndex}")
    public void setRedisIndexUtils(int redisIndexUtils) {
        REDIS_INDEX_UTILS = redisIndexUtils;
    }
}
